﻿
//查询条件栏显示控制
function ShowQueryView() {
    var obj = document.getElementById('tbQuery');
    var img = document.getElementById('ToggleImage');
    var locahref = document.location.href;
    if (obj != null && obj.style.display == "block") {
        obj.style.display = "none";
        img.src = "../../App_Themes/default/images/expandpic.jpg";
        setCookie(locahref, 'none');
    }
    else {
        obj.style.display = "block";
        img.src = "../../App_Themes/default/images/collapse.jpg";
        setCookie(locahref, 'block');
    }
}
//获取url里的参数值 name:参数名称
function getPar(source, name) {
    var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
    if (reg.test(source))
        return RegExp.$2;
    return "";
};
function getPar1(name) {
    var _url = "http://" + document.location;
    return getPar(_url, name);
}
////查询条件栏显示控制
function GetQueryCookie() {
    var locahref = document.location.href;
    var isShow = getCookie(locahref);
    var obj = $get('tbQuery');
    var img = $get('ToggleImage');
    if (obj == null || img == null) return false;
    if (isShow == 'none') {
        obj.style.display = "none";
        img.src = "../../App_Themes/default/images/expandpic.jpg";
    }
    if (isShow == 'block') {
        obj.style.display = "block";
        img.src = "../../App_Themes/default/images/collapse.jpg";
    }
}

//取得Cookie的值
function getCookie(cName) {
    if (document.cookie.length > 0) {
        var intEnd = -1;
        var intStart = document.cookie.indexOf(cName + "=")
        if (intStart != -1) {
            intStart = intStart + cName.length + 1;
            intEnd = document.cookie.indexOf(";", intStart);
        }
        if (intEnd == -1) {
            intEnd = document.cookie.length;
        }
        return unescape(document.cookie.substring(intStart, intEnd));
    }
    return null;
}
//设置Cookie的值
function setCookie(cName, cValue) {
    document.cookie = cName + "=" + escape(cValue);
}